import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ApplyBuyRecordVO, ApplyBuyRecordForm, ApplyBuyRecordQuery } from '@/api/system/applyBuyRecord/types';

/**
 * 查询租户购买应用记录列表
 * @param query
 * @returns {*}
 */

export const listApplyBuyRecord = (query?: ApplyBuyRecordQuery): AxiosPromise<ApplyBuyRecordVO[]> => {
    return request({
        url: '/order/applyBuyRecord/list',
        method: 'get',
        params: query
    });
};

/**
 * 查询租户购买应用记录详细
 * @param id
 */
export const getApplyBuyRecord = (id: string | number): AxiosPromise<ApplyBuyRecordVO> => {
    return request({
        url: '/order/applyBuyRecord/' + id,
        method: 'get'
    });
};

/**
 * 新增租户购买应用记录
 * @param data
 */
export const addApplyBuyRecord = (data: ApplyBuyRecordForm) => {
    return request({
        url: '/order/applyBuyRecord',
        method: 'post',
        data: data
    });
};

/**
 * 修改租户购买应用记录
 * @param data
 */
export const updateApplyBuyRecord = (data: ApplyBuyRecordForm) => {
    return request({
        url: '/order/applyBuyRecord',
        method: 'put',
        data: data
    });
};

/**
 * 删除租户购买应用记录
 * @param id
 */
export const delApplyBuyRecord = (id: string | number | Array<string | number>) => {
    return request({
        url: '/order/applyBuyRecord/' + id,
        method: 'delete'
    });
};
export default {
    list: listApplyBuyRecord,
    get: getApplyBuyRecord,
    add: addApplyBuyRecord,
    update: updateApplyBuyRecord,
    del: delApplyBuyRecord,
}